<?php
$this->sendDebugMessage("uno model start");

$user = $this->userCenter->userList[$ip];
$tid = $user->tableID;
$rid = $user->roomID;
$tb = $this->userCenter->roomList[$rid]->tableList[$tid];
$seat = $tb->seatList[$user->seatID];

if($seat->uno) return;

if(count($seat->cardList) > 1)
{
	//罚牌
	$pcard = getPunishCard($tb,$user);
	
	$response = new Response();
	$response->event = "SE_UNO_PUNISH";
	$response->body = '{"seat":"'.$user->seatID.'","userID":"'.$ip.'","card":["'.implode("\",\"",$pcard).'"]}';
	$this->sendData($ip,$response);
	
	$response->event = "SE_UNO_PUNISH_UPDATE";
	$response->body = '{"seatID":"'.$user->seatID.'","userID":"'.$ip.'","card":'.count($pcard).'}';
	$this->broadcastGroup($response,$this->userCenter->roomList[$user->roomID]->tableList[$user->tableID]->getUserList(),array($ip));
}else{
	$seat->uno = true;
	//向本人发送准备状态
	$response = new Response();
	$response->event = "SE_UNO";
	$response->body = '{"seatID":"'.$user->seatID.'","userID":"'.$ip.'"}';
	$this->sendData($ip,$response);
	
	//向当前游戏桌的其他玩家发送准备状态
	$response->event = "SE_UNO_UPDATE";
	$this->broadcastGroup($response,$this->userCenter->roomList[$user->roomID]->tableList[$user->tableID]->getUserList(),array($ip));
	
}

$this->sendDebugMessage("uno model end");